import http from '@/utils/http';
import {request} from '@/utils/axios';


/**
 * 删除区域信息
 * @param params
 * @returns {*|Promise<any>}
 */
export const removeStructure = (params: any) => {
  return http.delete('bus/structure/remove', {params});
}

/**
 * 获取系统用户列表
 * @param params
 * @returns {*|Promise<any>}
 */
export const getStructureList = (params?: any) => {
  return http.get('bus/structure/list', {params});
}


/**
 * 获取系统用户列表
 * @param params
 * @returns {*|Promise<any>}
 */
export const getStructureMap = (params?: any) => {
  return http.get('bus/structure/map', {params});
}


/**
 * 保存修改区域信息
 * @param params
 * @returns {*|Promise<any>}
 */
export const updateStructure = (params: any) => {
  return http.put('bus/structure/edit', params);
}

/**
 * 保存新增区域信息
 * @param params
 * @returns {*|Promise<any>}
 */
export const addStructure = (params: any) => {
  return http.post('bus/structure/add', params);
}

/**
 * 通过id获取区域信息
 * @param params
 * @returns {*|Promise<any>}
 */
export const getStructureById = (params: any) => {
  return http.get('bus/structure/' + params.id);
}

/**
 * 验证区域名称是否唯一
 * @param params
 * @returns {*|Promise<any>}
 */
export const checkStructureNameUnique = (params: any) => {
  params.loading = false;
  return http.post('bus/structure/checkNameUnique', params);
}

/**
 * 下载用户导入模板
 * @returns {*|Promise<any>}
 */
export const downloadStructureData = (params?: any) => {
  return http.get('bus/structure/exportExcel',{params});
}

export const downloadWord = (params?: any) => {
  return request.post('bus/structure/exportWord',params);
}

export const downloadPdf = (params?: any) => {
  return request.post('bus/structure/exportPdf',params,{
    timeout:60000
  });
}

export const extractStructure = (params?: any) => {
  return request.post('bus/structure/extractStructure',params);
}

export const subCodeMap = (params?: any) => {
  return request.post('bus/structure/subCodeMap',params);
}



